Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sealedoff #1

Closed
wants to merge 9 commits into from
Closed

Sealedoff #1

wants to merge 9 commits into from

Conversation

jeancallisti
Copy link

This branch focuses on "sealing off" this module's script from the global script and from the game.
The goal is to make this module less dependant on any global data from the game.

Specifically :

  • Removing global variables from the script (GUI names, font names...). Now they must be set up externally (only once) at game startup time.
  • Moving as much code as possible from the global script to the module script. Ultimately, the call OptionGui.OnClick would disappear from the global script, but independant click detection is not implemented yet.

Additionally to that, some (moderate) effort is put into gathering global variables from the modules' scripts into objects (structs), as members. This achieves two things : 1) This acts like a primitive namespace (you know instantly where the variables come from), 2) This certifies that there are no unexepected "export" of variables.

BERGOUNIOUX Mathieu added 5 commits August 5, 2018 15:24
- removed all global variables (GUIs and fonts). They must now be set once using a function.
- removed export on ItemGiven and created an accessor instead.
- Similarly, added an accessor on UsedAction
…r Save, one for Load and one for Options

- I have removed global variables from the Options script : the fonts and the GUIs must now be set externally, in TemplateSettings
- I have moved "Offset" and "Distance" to a utility class
@ghost
Copy link

ghost commented Aug 8, 2018

@jeancallisti , something I noticed:

#ifndef __OPTION_GUI_MODULE__ //a dependency is missing
    void game_start()
    {
        AbortGame("Missing module 'OptionGui'");
    }
 #endif

You could instead use #error command like

#ifndef __OPTION_GUI_MODULE__ //a dependency is missing
    #error Missing module 'OptionGui'
#endif

This will report error at compile time.

Mathieu Bergounioux added 4 commits August 9, 2018 15:00
- added reminders to remove references to gMain
- fixed some references to global variables that I overlooked in previous commits
…data independently frm their current state

- made it possible to setup the buttons and their graphics outside of the module for better integration with larger code base
- Made function Verbs::GetButtonAction more robust (had issues dealing with action 0)
- Made most enums start at value 0 instead of 1, to avoid a "dead" value at the beginning of iterations
@dkrey
Copy link
Owner

dkrey commented Nov 6, 2018

This pull request has some issues.
GlobalScript Line 48 should be: Verbs.Localize();
GlobalScript Line 62 should be: Verbs.SetAction(Verbs.GetButtonAction(control.AsButton));

Also in your branch the functions dropdown in the AGS Editor doesn't work anymore, or it least it can't show any functions.
I've fixed the bugs and merged your commits manually.

@dkrey dkrey closed this Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants